<template>
  <div id="outer" class="scroll">
  <keep-alive>
	  <router-view></router-view>
  </keep-alive>
      <!--<keep-alive >-->
          <!--<router-view v-if="$route.meta.keepAlive"></router-view>-->
      <!--</keep-alive>-->
      <!--<router-view v-if="!$route.meta.keepAlive"></router-view>-->
  </div>
</template>

<script>
export default {
    name: 'app',
    methods: {
        Init() {
            var overscroll = function(el){
                el.addEventListener('touchstart', function(){
                    var top = el.scrollTop;
                    var totalScroll = el.scrollHeight;
                    var currentScroll = top + el.offsetHeight;
                    if(top === 0) {
                        el.scrollTop = 1;
                    }else if(currentScroll === totalScroll){
                        el.scrollTop = top - 1;
                    }
                });
                el.addEventListener('touchmove', function(evt){
                    if(el.offsetHeight < el.scrollHeight){
                        evt._isScroller = true;
                    }
                });
            }
            overscroll(document.querySelector('.scroll'));//哪里需要可以局部滚动，添加一个“scroll”的class
            document.body.addEventListener('touchmove', function(evt) {
                if(!evt._isScroller){
                    //evt.preventDefault();
                }
            });
        },
    },
    mounted() {
        this.Init();
    },

}

</script>

<style lang="scss">

</style>
